<?php

defined('RUN') or die('No access');
class Editor
{
    public static function clearSession()
    {
        unset($_SESSION['svdm_allow_upload']);
        return true;
    }
    public static function display($a, $b = null, $c = true, $d = 5, $e = 60)
    {
        $f = '';
        if ($c)
        {
            $_SESSION['svdm_allow_upload'] = true;
        } else
        {
            $_SESSION['svdm_allow_upload'] = false;
        }
        $g = '<textarea name="' . $a . '" id="' . $a . '" cols="' . $e . '" rows="' . $d .
            '">' . htmlspecialchars($b) . '</textarea>';
        $g .= "\n<script type='text/javascript'>
                        $().ready(function() {
                            $('#{$a}').elrte(opts" . ($c ? 2 : 1) . ");
                        });
                        </script>";
        return $g;
    }
    public static function parseHeader($h = false)
    {
        $i='';
        $i .= '<link rel="stylesheet" type="text/css" href="' . Asset::css('/scripts/editor/css/elrte.min.css') .
            '" media="all">';
        $i .= '<script type="text/javascript" src="' . Asset::js('/scripts/editor/js/elrte.min.js') .
            '"></script>';
        if ($h)
        {
            $i .= '<link rel="stylesheet" type="text/css" href="' . Asset::css('/scripts/filemanager/css/elfinder.min.css') .
                '" media="all">';
            $i .= '<link rel="stylesheet" type="text/css" href="' . Asset::css('/scripts/filemanager/css/theme.css') .
                '" media="all">';
            $i .= '<script type="text/javascript" src="' . Asset::css('/scripts/filemanager/js/elfinder.min.js') .
                '"></script>';
        }
        return $i;
    }
}